#include <bits/stdc++.h>
using namespace std;
const int maxn=1e5+10;
const int mod=998244353;
int main()
{
	ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);

	int t;
	cin >> t;
	while(t--)
	{
		string s;
		cin >> s;
		int l=0,r=s.size()-1;
		int count=0;
		while(l<=r)
		{
			if(s[l]!=s[r])
			{
				count++;
			}
			l++;
			r--;
		}
		cout << count << endl;
	}
    return 0;
}

